package com.yy.wga.mp.module.order.task;

import com.yy.wga.mp.module.order.manager.PullOrderManager;
import com.yy.wga.common.core.aop.DistributedLock;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: gc
 * @Date: 2024/10/30
 * @Description:
 **/
@Slf4j
@RequiredArgsConstructor
@Component
public class PullOrderTask {
    private final PullOrderManager pullOrderManager;


    /**
     * 40秒执行一次
     */
    @Scheduled(fixedRate = 40000)
    @DistributedLock(value = "'pullOrder'")
    public void pullOrder() {
        log.info("开始拉单");
        pullOrderManager.pullOrder(5);
        log.info("拉单完成");
    }
}
